package h.a.a.j;

import h.a.a.f;

/* compiled from: SqlUtils */
public class d {
    public static final /* synthetic */ int a = 0;

    static {
        "0123456789ABCDEF".toCharArray();
    }

    public static StringBuilder a(StringBuilder stringBuilder, String str, String[] strArr) {
        for (int i = 0; i < strArr.length; i++) {
            String str2 = strArr[i];
            stringBuilder.append(str);
            stringBuilder.append(".\"");
            stringBuilder.append(str2);
            stringBuilder.append('\"');
            stringBuilder.append("=?");
            if (i < strArr.length - 1) {
                stringBuilder.append(',');
            }
        }
        return stringBuilder;
    }

    public static StringBuilder b(StringBuilder stringBuilder, String str, f fVar) {
        if (str != null) {
            stringBuilder.append(str);
            stringBuilder.append('.');
        }
        stringBuilder.append('\"');
        stringBuilder.append(fVar.e);
        stringBuilder.append('\"');
        return stringBuilder;
    }

    public static String c(String str, String[] strArr) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append('\"');
        stringBuilder.append(str);
        stringBuilder.append('\"');
        str = stringBuilder.toString();
        stringBuilder = new StringBuilder("DELETE FROM ");
        stringBuilder.append(str);
        if (strArr != null && strArr.length > 0) {
            stringBuilder.append(" WHERE ");
            a(stringBuilder, str, strArr);
        }
        return stringBuilder.toString();
    }

    public static String d(String str, String str2, String[] strArr) {
        StringBuilder stringBuilder = new StringBuilder(str);
        stringBuilder.append('\"');
        stringBuilder.append(str2);
        stringBuilder.append('\"');
        stringBuilder.append(" (");
        int length = strArr.length;
        for (int i = 0; i < length; i++) {
            stringBuilder.append('\"');
            stringBuilder.append(strArr[i]);
            stringBuilder.append('\"');
            if (i < length - 1) {
                stringBuilder.append(',');
            }
        }
        stringBuilder.append(") VALUES (");
        int length2 = strArr.length;
        for (int i2 = 0; i2 < length2; i2++) {
            if (i2 < length2 - 1) {
                stringBuilder.append("?,");
            } else {
                stringBuilder.append('?');
            }
        }
        stringBuilder.append(')');
        return stringBuilder.toString();
    }

    public static String e(String str, String str2, String[] strArr, boolean z) {
        if (str2.length() >= 0) {
            StringBuilder stringBuilder = new StringBuilder(z ? "SELECT DISTINCT " : "SELECT ");
            int length = strArr.length;
            for (int i = 0; i < length; i++) {
                String str3 = strArr[i];
                stringBuilder.append(str2);
                stringBuilder.append(".\"");
                stringBuilder.append(str3);
                stringBuilder.append('\"');
                if (i < length - 1) {
                    stringBuilder.append(',');
                }
            }
            stringBuilder.append(" FROM ");
            stringBuilder.append('\"');
            stringBuilder.append(str);
            stringBuilder.append('\"');
            stringBuilder.append(' ');
            stringBuilder.append(str2);
            stringBuilder.append(' ');
            return stringBuilder.toString();
        }
        throw new h.a.a.d("Table alias required");
    }
}
